<?php


namespace app\user\controller;

use app\index\controller\Base;//application统一的模式，不要修改
use app\user\model\Healthdata as HealthdataModel;  //引入model.
// use app\common\controller\DataCrypt;  来自旧版本，遂注释掉

class Healthdata extends Base
{

    public function get(){
        $user = new HealthdataModel();
        $data=$this->request->param();
        $d=$user->with("dataType")
            ->where($data['field'],$data['op'],$data['value'])
            ->where('type',$data['type'])
            ->page($data['page'])
            ->order('cTime desc')
            ->limit(7)
            ->select();
        return $d;
    }
    public function update()
    {
        $data = $this->request->param();
        $res = new HealthdataModel();
        return $res->updateModel($data);
    }
    public function delete(){
        $data = $this->request->param();
        $res = new HealthdataModel();
        return $res->deleteModel($data);
    }
    public function save(){
        $res = new HealthdataModel();
        $data = $this->request->param();
        $res->saveModel($data);
    }
}